/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tiketBioskop.koneksi;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author sepha
 */

public class koneksiDataBase {

    private static Connection conn;
//untuk koneksi datbase
    public static Connection getConnection() {
        if (conn == null) {
            try {
                //untuk mengkoneksikan database dengan java
                DriverManager.registerDriver(new com.mysql.jdbc.Driver());
                conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/tiketbioskop", "root", "1234");
            } catch (SQLException ex) {
                Logger.getLogger(koneksiDataBase.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return conn;
    }
}
